package huoye.shops.huoye.operation.widget;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.codeideology.android.widget.ios.dialog.base.BaseDialog;

import huoye.shops.R;
import huoye.shops.base.BaseCustomDialog;


/**
 * Created by uesr on 2018/8/11.
 */

public class SelectImageDialog extends BaseDialog<SelectImageDialog>{



    private Context mContext;
    private ImageView ivOut;
    private TextView tvLocal;
    private TextView tvPhotos;


    public SelectImageDialog(Context context) {
        super(context);
        this.mContext = context;
    }

    @Override
    public View onCreateView() {
        widthScale(0.75f);
        View inflate = View.inflate(context, R.layout.dialog_select_image, null);
        ivOut = (ImageView) inflate.findViewById(R.id.dialog_select_image_iv_out);
        tvLocal = (TextView) inflate.findViewById(R.id.dialog_select_image_tv_local);
        tvPhotos = (TextView) inflate.findViewById(R.id.dialog_select_image_tv_photos);

        return inflate;
    }

    @Override
    public void setUiBeforShow() {
        ivOut.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        });
        tvLocal.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onLocalClick();
                dismiss();
            }
        });
        tvPhotos.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onPhotosClick();
                dismiss();
            }
        });
    }





    public interface OnImageListener {
        void onLocalClick();
        void onPhotosClick();
    }
    public void setOnImageListener(OnImageListener onListener) {
        this.listener = onListener;
    }

    private OnImageListener listener;

}
